
import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { getBasicInfoURL } from '../../../api.module';
import { FetchRequestService } from '../../service/fetch-request/fetch-request.service';

@Component({
  selector: 'app-overview',
  templateUrl: './overview.component.html',
  styleUrls: ['./overview.component.css'],
  providers: [FetchRequestService, NzMessageService]
})
export class OverviewComponent implements OnInit {

  public version: String;
  public arch: String;
  public goVersion: String;
  public os: String;
  public kernelVersion: String;
  public apiVersion: String;
  public miniAPIVersion: String;
  public isExperiment: String;
  public buildTime: String;

  constructor(
    private http: FetchRequestService,
    private message: NzMessageService
  ) { }

  ngOnInit() {

    this.http.getRequest(getBasicInfoURL.toString()).then(
      res => {
        console.log(JSON.stringify(res));
        this.version = res['Version'];
        this.arch = res['Arch'];
        this.goVersion = res['GoVersion'];
        this.os = res['Os'];
        this.kernelVersion = res['KernelVersion'];
        this.apiVersion = res['ApiVersion'];
        this.miniAPIVersion = res['MinAPIVersion'];
        this.isExperiment = res['Experimental'];
        this.buildTime = res['BuildTime'];
      },
      error => {
        console.log(error);
      }
    );
  }

}
